package com.me.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

@WebFilter("/*")
public class EncodingFilter implements Filter {
    public void destroy() {
        System.out.println("中文编码验证过滤器销毁");
    }

	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		chain.doFilter(request,response);
	}

	public void init(FilterConfig config) throws ServletException {
		System.out.println("中文编码过滤器启动");
	}
}
